WebWork's validators are designed to be as independent of each other as possible, such that a validator like 'stringlength' should just validate the lenght of the input string. It will not attempt to validate an empty string as that would overlap with the 'requiredstring' validator, for example. If we need to validate against an input that should not be empty and should have a certain length, we would apply the following validator sequence :
If we need to validate against an input that should have a certain length but it doesn't matter if nothing is specified, we could apply the following validator sequence :
Without the concept of 'independent responsibility' in each validator design, the second case in the above described senarios would not be possible to achieve. For more information about validators, have a look at Validation. |